extends Node2D
class_name BaseLevel

const finish_coords := Vector2(16, 12)
@onready var player := $Player

enum Commands
{
	MOVE,
	ROTATE_LEFT,
	ROTATE_RIGHT,
	WAIT,
}

func process_commands_list(commands) -> void:
	for command in commands:
		match command.command:
			Commands.MOVE:
				player.move()
			Commands.ROTATE_LEFT:
				player.rotate_left()
			Commands.ROTATE_RIGHT:
				player.rotate_right()
			Commands.WAIT:
				player.hunger -= 1
		await player.command_finished
	if check_finish():
		print("win")

func check_finish() -> bool:
	if player.coords == finish_coords:
		return true
	return false

func check_death() -> bool:
	if player.hunger == 0:
		return true
	return false
